import { ref } from 'vue'
import { defineStore } from 'pinia'

export const useUserStore = defineStore(
  'user',
  () => {
    const userInfo = ref({})
    const setUserData = (obj) => {
      userInfo.value = obj
    }
    const logout = () => {
      setUserData({})
    }
    return {
      userInfo,
      setUserData,
      logout
    }
  },
  { persist: true }
)
